import { h } from "vue";

import Score from "@/components/System/Score.vue"
import State from "@/components/System/State.vue"
import SystemId from "@/components/System/SystemId.vue"
import Type from "@/components/System/Type.vue"

export const columns = [{
  title: '系统名称',
  slotName: 'name',
  width: 100,
  render: ({ record }) => h(SystemId, { record })
},
{
  title: '系统评分',
  slotName: 'healthScore',
  width: 80,
  render: ({ record }) => h(Score, { record })
},
{
  title: '系统节点状态',
  slotName: 'normalCount',
  width: 120,
  render: ({ record }) => h(State, { record })
},
{
  title: '系统类型',
  slotName: 'type',
  width: 100,
  render: ({ record }) => h(Type, { record })
},
{
  title: '总请求量',
  dataIndex: 'requestTotalCount',
  width: 100,
  render: ({ record }) => h('span', {}, `${record?.requestTotalCount}万`)
},
{
  title: '平均响应时间',
  dataIndex: 'avgResponseTime',
  width: 110,
  render: ({ record }) => h('span', {}, `${record?.avgResponseTime}ms`)
},
{
  title: '错误率',
  dataIndex: 'errorRate',
  width: 100,
},
{
  title: '告警率',
  dataIndex: 'alarmCount',
  width: 100,
},
{
  title: '所属集群',
  dataIndex: 'belongCluster',
  width: 100,
},
{
  title: '操作',
  slotName: 'operation',
  width: 100,
}]